package com.api.shopapi.mapper;


import com.api.shopapi.entity.NursingSchedulingMorningItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface NursingSchedulingMorningItemMapper {

    @Insert("insert into nursing_scheduling_morning_item " +
            "(NursingSchedulingMorningItemCode,NursingSchedulingMorningCode,NurseCode,NurseName,NurseAideCode,NurseAideName) " +
            "values (#{nursingSchedulingMorningItem.NursingSchedulingMorningItemCode} ,#{nursingSchedulingMorningItem.NursingSchedulingMorningCode} ,#{nursingSchedulingMorningItem.NurseCode} ," +
            "#{nursingSchedulingMorningItem.NurseName} ,#{nursingSchedulingMorningItem.NurseAideCode} ,#{nursingSchedulingMorningItem.NurseAideName} )")
    int insert(@Param("nursingSchedulingMorningItem") NursingSchedulingMorningItem nursingSchedulingMorningItem);

    @Update("update nursing_scheduling_morning_item set NursingSchedulingMorningCode=#{nursingSchedulingMorningItem.NursingSchedulingMorningCode} ,NurseCode=#{nursingSchedulingMorningItem.NurseCode} ,NurseName=#{nurseSchedulingMorningItem.NurseName} ,NursingAideCode=#{nursingSchedulingMorningItem.NurseAideCode} ,NursingAideName=#{nursingSchedulingMorningItem.NurseAideName} where NursingSchedulingMorningItemCode=#{nursingSchedulingMorningItem.NursingSchedulingMorningItemCode}  ")
    int updateByNursingSchedulingMorningItemCode(@Param("nursingSchedulingMorningItem") NursingSchedulingMorningItem nursingSchedulingMorningItem);

    @Delete("delete from nursing_scheduling_morning_item where NursingSchedulingMorningItemCode=#{nursingSchedulingMorningItemCode} ")
    int deleteByNursingSchedulingMorningItemCode(@Param("nursingSchedulingMorningItemCode") String nursingSchedulingMorningItemCode);

    @Select("select * from nursing_scheduling_morning_item where NursingSchedulingMorningItemCode=#{nursingSchedulingMorningItemCode} limit 1")
    NursingSchedulingMorningItem getByNursingSchedulingMorningItemCode(@Param("nursingSchedulingMorningItemCode")String nursingSchedulingMorningItemCode);

    @Select("select * from nursing_scheduling_morning_item where NursingSchedulingMorningCode=#{nursingSchedulingMorningCode}")
    List<NursingSchedulingMorningItem> getListByNursingSchedulingMorningCode(@Param("nursingSchedulingMorningCode")String nursingSchedulingMorningCode);

    @Delete("delete from nursing_scheduling_morning_item where NursingSchedulingMorningCode=#{nursingSchedulingMorningCode} ")
    int deleteByNurseSchedulingMorningCode(String nursingSchedulingMorningCode);

    @Select("select * from nursing_scheduling_morning_item where NursingSchedulingMorningCode=#{nursingSchedulingMorningCode} and NurseAideCode=#{nurseAideCode} limit 1")
    NursingSchedulingMorningItem getByNursingSchedulingMorningCodeAndNurseAideCode(@Param("nursingSchedulingMorningCode") String nursingSchedulingMorningCode, @Param("nurseAideCode") String nurseAideCode);

    @Select("select * from nursing_scheduling_morning_item where NursingSchedulingMorningCode=#{nursingSchedulingMorningCode} and NurseCode=#{nurseCode} limit 1")
    NursingSchedulingMorningItem getByNursingSchedulingMorningCodeAndNurseCode(@Param("nursingSchedulingMorningCode") String nursingSchedulingMorningCode, @Param("nurseCode") String nurseCode);
}
